import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';
import { PARAMS } from '../components/public/BlogUtils';

// 我的关注及搜索
export const getMyAttentionUsers = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getMyAttentionUsers',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 我的关注及搜索
export const getMyOrganizationUsers = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getMyOrganizationUsers',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 我的关注
export const getMyBlogAttention = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getMyBlogAttention',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 分享给我（排除我关注的）
export const getShareToMeList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getShareToMeUserList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}


// 我的关注人员分组信息
export const getMyAttentionGroup = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/setting/getMyAttentionGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 粉丝操作
export const attentionMeOpt = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/attentionMeOpt',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}


export const batchAttentionOpt = params =>{
	let options = {
		method: 'POST',
		url: '/api/blog/base/batchAttentionOpt',
		params: {...PARAMS, ...params}
	};
    return Tools.callApi(options).then(catchApiError);
}

// 关注操作
export const attentionOpt = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/attentionOpt',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 取消关注
export const cancelAttention = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/cancelAttention',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 全部微博
export const getBlogHomepageList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getBlogHomepageList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 关注的人统计提交情况统计信息
export const getAttentionCountInfos = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getAttentionCountInfos',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 我的微博--我的关注--某天关注人的微博列表
export const getAttentionWorkDateList = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getAttentionWorkDateList',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 提醒提交微博All
export const sendRemindUnsubmitAll = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/sendRemindUnsubmitAll',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

/* 分组管理 */
// 新建分组Condition 请求
export const getBlogGroupAdd = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/myblog/getBlogGroupAdd',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 新建分组
export const createBlogGroup = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/setting/createBlogGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 编辑分组
export const editBlogGroup = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/setting/editBlogGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

/* 删除分组 */
export const deleteBlogGroup = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/setting/deleteBlogGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 分享给我及搜索
export const getMyAttentionShare = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getMyAttentionShare',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 我的粉丝
export const getMyAttentionMesUsers = params => {
	let options = {
		method: 'GET',
		url: '/api/blog/base/getAttentionMesUsers',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 移动到组
export const moveContactToBlogGroup = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/setting/moveContactToBlogGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 复制到组
export const copyContactToBlogGroup = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/setting/copyContactToBlogGroup',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 批量取消关注
export const batchCancelAttn = params => {
	let options = {
		method: 'POST',
		url: '/api/blog/base/batchCancelAttn',
		params: {...PARAMS, ...params}
	};
	return Tools.callApi(options).then(catchApiError);
}

// 批量关注
export const batchAttention = params => {

    let options = {
        method: 'POST',
        url: '/api/blog/attention/batchattention',
        params: {...PARAMS, ...params}
    };
    return Tools.callApi(options).then(catchApiError);
}



export const addSpecialUsers = (params) => {
    let options = {
        method: 'POST',
        url:'/api/blog/myblog/addSpecialUser',
        params: {...PARAMS, ...params}
    }
    return Tools.callApi(options).then(catchApiError);
}

export const cancelSpecialUsers = (params) => {
    let options = {
        method: 'POST',
        url:'/api/blog/myblog/cancelSpecialUser',
        params: {...PARAMS, ...params}
    }
    return Tools.callApi(options).then(catchApiError);
}

export const batchCancelSpecialUsers = (params) => {
    let options = {
        method: 'POST',
        url:'/api/blog/myblog/batchSpecialUser',
        params: {...PARAMS, ...params}
    }
    return Tools.callApi(options).then(catchApiError);
}

export const outAttentionUsers = (params) =>{
    let options = {
        method: 'GET',
        url:'/api/blog/myblog/outattentionlist',
        params: {...PARAMS, ...params}
    }
    return Tools.callApi(options).then(catchApiError);
}

